package com.hunau.novel_reading.service.impl;

import com.hunau.novel_reading.entity.Books;
import com.hunau.novel_reading.mapper.HistoryMapper;
import com.hunau.novel_reading.request.HistoryInsertReq;
import com.hunau.novel_reading.request.HistorySeekReq;
import com.hunau.novel_reading.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HistoryServiceImpl implements HistoryService {
    @Autowired
    private HistoryMapper historyMapper;
    @Override
    public List<Books> selectBooksByUsername(HistorySeekReq historySeekReq) {
        return historyMapper.selectBooksByUsername(historySeekReq.getUsername());
    }
    @Override
    public Integer insertHistoryRecordByUserAndBookName(HistoryInsertReq historyInsertReq) {
        return historyMapper.insertHistoryRecordByUserAndBookName(historyInsertReq.getUserId(), historyInsertReq.getBookId());
    }
    @Override
    public List<Books> selectBooksByUserId(Integer userId) {
        return historyMapper.selectBooksByUserId(userId);
    }
}
